package com.wookii.friedeggs.ui.home

import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.baidu.ocr.sdk.model.WordSimple
import com.bw.base.tool.BindingViewHolder
import com.bw.base.tool.newBindingViewHolder
import com.wookii.friedeggs.data.Student
import com.wookii.friedeggs.databinding.ItemStudentsBinding

/**
 *@Author Nick.wu
 *Date 2023/9/25
 */
class StudentsListAdapter(var data: MutableList<Student>, function: (Student) -> Unit) :
    RecyclerView.Adapter<BindingViewHolder<ItemStudentsBinding>>() {
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): BindingViewHolder<ItemStudentsBinding> {
        return newBindingViewHolder(parent)
    }

    override fun getItemCount(): Int = data.size

    override fun onBindViewHolder(holder: BindingViewHolder<ItemStudentsBinding>, position: Int) {
        data[position].apply {
            holder.binding.itemStudentName.text = this.name
        }
    }
}